package com.java.action;

import java.util.List;

import com.java.pojo.ComDept;
import com.java.service.IDeptService;

public class Dept2Action {
private IDeptService deptservice;
private List<ComDept> deptlist;
private int page=1;
private int currentPage;
private int totalPages;
private static final int PAGEROW=3;


public String execute(){
	int count=deptservice.getDeptNum();
	totalPages=(count%PAGEROW==0)?(count/PAGEROW):(count/PAGEROW+1);
	if(page<1){	
		page=1;
	}
	System.out.println("deptact2222...................");
	if(page>totalPages){
		page=totalPages;
	}
	int start=(page-1)*PAGEROW;
	currentPage=page;
	deptlist=deptservice.getDeptListByPage(start,PAGEROW);
	
	return "success";
}
public IDeptService getDeptservice() {
	return deptservice;
}
public void setDeptservice(IDeptService deptservice) {
	this.deptservice = deptservice;
}
public List<ComDept> getDeptlist() {
	return deptlist;
}
public void setDeptlist(List<ComDept> deptlist) {
	this.deptlist = deptlist;
}
public Integer getPage() {
	return page;
}
public void setPage(Integer page) {
	this.page = page;
}
public Integer getCurrentPage() {
	return currentPage;
}
public void setCurrentPage(Integer currentPage) {
	this.currentPage = currentPage;
}
public Integer getTotalPages() {
	return totalPages;
}
public void setTotalPages(Integer totalPages) {
	this.totalPages = totalPages;
}
public static Integer getPagerow() {
	return PAGEROW;
}


}
